<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>练习get通信</title>
   </head>
<body>
 <form>
     <div>
         <input type="text" placeholder="用户名" id="username"/>
     </div>
     <div>
         <button id="btn">登录</button>
     </div>
 </form>

</body>
<script src="../../webstie/lib/jquery.js"></script>
<script>
    $('#btn').bind('click',function () {
        $.ajax({
            url:'http://localhost:3000/1.get',
            method:'get',
            getType:'json',
            data:{
                username:$('#username').val()
            },
            success:function (data) {
                console.log(data);
                if(data.flag){
                    window.location.href="home.html"
                }
            }
        })
    })
</script>

</html>
